package com.gameapplet.cash.controller;

import com.gameapplet.cash.model.Balance;
import com.gameapplet.cash.service.Impl.BalanceServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/balance")
public class BalanceController {
    @Resource(name = "balanceService")
    BalanceServiceImpl balanceService;

    @RequestMapping("/getBalance/{openid}")
    @ResponseBody
    public Balance getBalance(@PathVariable(value = "openid") String openid){
        Balance balance = balanceService.selectBalanceByOpenid(openid);
        if (balance!=null) {
            return balance;
        }
        return null;
    }

}
